package com.jic.point.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jic.common.base.vo.PageResult;
import com.jic.manager.api.manage.SysDeptApi;
import com.jic.manager.response.SysDeptResponse;
import com.jic.order.api.ProductApi;
import com.jic.order.manage.response.OrderResponse;
import com.jic.order.response.OrderGoodsResponse;
import com.jic.point.constant.consist.ResponseCode;
import com.jic.point.exception.AppRuntimeException;
import com.jic.point.mapper.*;
import com.jic.point.model.entity.*;
import com.jic.point.service.SettSupplierBalanceService;
import com.jic.product.after.api.ProductListApi;
import com.jic.product.manage.response.ProductResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * 接口实现类
 *
 * @author : tzc
 * @version : v1.0.0
 * @email :
 * @since : 2020-03-09 10:12:20
 */
@Service
@Slf4j
public class SettSupplierBalanceServiceImpl implements SettSupplierBalanceService {

    @Resource
    private SettSupplierBalanceMapper mapper;
    @Resource
    private ConfPlatformMapper confPlatformMapper;
    @Resource
    private ConfActivityRuleMapper confActivityRuleMapper;
    @Resource
    private ConfPlatformLogMapper confPlatformLogMapper;
    @Resource
    private ConfActivityRuleLogMapper confActivityRuleLogMapper;
    @Resource
    ConfSupplierLogMapper confSupplierLogMapper;
    @Resource
    SettSupplierRuleMapper ruleMapper;
    @Autowired
    SysDeptApi sysDeptApi;
    @Resource
    SettSupplierBalanceMapper supplierBalanceMapper;
    @Resource
    ConfThirdPartMapper confThirdPartMapper;
    @Resource
    SettSupplierLogMapper settSupplierLogMapper;
    @Autowired
    SettSupplierRuleMapper supplierRuleMapper;
    @Autowired
    ConfBdMapper confBdMapper;
    @Autowired
    ProductListApi productListApi;
    @Autowired
    ProductApi orderApi;



    /**
     * 新增记录
     *
     * @param request 需要保存的入参实体类
     * @return int 是否保存成功
     */
    @Override
    public int save(SettSupplierBalance request) {
        int flag = mapper.insert(request);
        if (flag == 1) {
            return 1;
        } else {
            throw new AppRuntimeException(ResponseCode.EXCEPTION, "新增失败");
        }
    }


    /**
     * 保存或修改记录信息
     *
     * @param request 需要保存的入参实体类
     * @return int 是否保存或修改成功
     * author tzc
     * @date 2020-3-11 20:54:09
     */
    @Override
    public int saveOrUpdate(SettSupplierBalance request) {
        log.info("保存或修改记录信息，入参 = {}", JSONObject.toJSONString(request));
        try {
            if (request == null) {
                throw new AppRuntimeException(ResponseCode.EXCEPTION, "入参为空");
            }
            if (request.getId() != null) {
                log.info("保存或修改记录信息，修改，入参 = {}", JSONObject.toJSONString(request));
                int flag = mapper.updateByPrimaryKey(request);
                if (flag == 1) {
                    return 1;
                }
            } else {
                log.info("保存或修改记录信息，保存，入参 = {}", JSONObject.toJSONString(request));
                int flag = mapper.insertSelective(request);
                if (flag == 1) {
                    return 1;
                } else {
                    throw new AppRuntimeException(ResponseCode.EXCEPTION, "修改失败");
                }
            }
        } catch (Exception e) {
            log.error("用户保存或修改失败", e);
            throw new AppRuntimeException(ResponseCode.EXCEPTION, "用户保存或修改失败");
        }
        return -1;
    }

    /**
     * 删除记录
     *
     * @param request 需要删除,含有主键的入参实体类
     * @return int 是否删除成功
     */
    @Override
    public int deleteByPrimaryKey(SettSupplierBalance request) {
        int flag = mapper.deleteByPrimaryKey(request);
        if (flag == 1) {
            return 1;
        } else {
            throw new AppRuntimeException(ResponseCode.EXCEPTION, "删除失败");
        }
    }


    /**
     * 逻辑删除记录
     *
     * @param request 含有主键的逻辑删除实体类
     * @return int 是否逻辑删除成功
     */
    @Override
    public int deleteByPrimaryKeyLogically(SettSupplierBalance request) {
        request.setDeleteFlag(1);
        int flag = mapper.updateByPrimaryKey(request);
        if (flag == 1) {
            return 1;
        } else {
            throw new AppRuntimeException(ResponseCode.EXCEPTION, "逻辑删除记录失败");
        }
    }


    /**
     * 修改
     *
     * @param request
     * @return
     */
    @Override

    public int updateByPrimaryKeySelective(SettSupplierBalance request) {
        try {
            log.info("修改记录");
            SettSupplierBalance param = new SettSupplierBalance();
            BeanUtils.copyProperties(request, param);
            int flag = mapper.updateByPrimaryKeySelective(param);
            if (flag == 1) {
                return 1;
            } else {
                throw new AppRuntimeException(ResponseCode.EXCEPTION, "修改记录失败");
            }
        } catch (Exception e) {
            log.error("修改记录失败", e);
            throw new AppRuntimeException(ResponseCode.EXCEPTION, "修改记录失败");
        }

    }

    /**
     * 记录详情
     *
     * @param request 查询的入参实体类
     * @return 数据库查询到的实体类
     */
    @Override
    public SettSupplierBalance getByPrimaryKey(SettSupplierBalance request) {
        return mapper.selectByPrimaryKey(request);
    }


    /**
     * 分页查询
     *
     * @param request 分页查询入参实体类
     * @return 含有分页信息的实体类列表
     */
    @Override
    public PageInfo<SettSupplierBalance> listPageBySelective(SettSupplierBalance request, int pageNum, int pageSize) throws ParseException {
        PageHelper.startPage(pageNum, pageSize);
        PageHelper.orderBy(" create_time desc");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        List<SettSupplierBalance> list = mapper.listPageBySelective(request);
        for (SettSupplierBalance supplierBalance : list) {
            List<ProductResponse> productResponses = productListApi.queryBySupplierCode(supplierBalance.getSupplierCode());
            for (ProductResponse productRespons : productResponses) {

                //商品数量
                List<OrderResponse> orderResponses = orderApi.queryBycommodityCode(productRespons.getCode(),sdf.format(supplierBalance.getSettStartTime()),sdf.format(supplierBalance.getSettEndTime()));
               //订单数量
                List<OrderResponse> orderResponses1 = orderApi.queryBycommodityCodeNumber(productRespons.getCode(),sdf.format(supplierBalance.getSettStartTime()),sdf.format(supplierBalance.getSettEndTime()));
                supplierBalance.setProductNumber(orderResponses.size());
                supplierBalance.setOrderNumber(orderResponses1.size());
                supplierBalance.setOrderResponseList(orderResponses1);
                for (OrderResponse orderResponse : orderResponses) {
                    // 商品订单明细
                    List<OrderGoodsResponse> orderGoodsResponses = orderApi.queryByOrderNoAndGoodsCode(orderResponse.getCommodityCode(), orderResponse.getOrderNo());
                    supplierBalance.setOrderGoodsResponseList(orderGoodsResponses);
                }
            }
        }
        PageInfo pageInfo = new PageInfo(list);
        PageResult<SettSupplierBalance> result = new PageResult<>();
        result.setTotal(pageInfo.getTotal());
        result.setRows(list);
        return new PageInfo(list);
    }

    /**
     * 不分页查询
     *
     * @param request 不分页查询入参实体类
     * @return 数据库查到的实体类列表
     */
    @Override
    public List<SettSupplierBalance> listAllRecord(SettSupplierBalance request) {
        //分页处理
        request.setDeleteFlag(0);
        return mapper.selectBySelective(request);
    }

    /**
     * 查询全部
     *
     * @return
     */
    @Override

    public List<SettSupplierBalance> getAllTheQuery() {

        return mapper.getAllTheQuery();

    }


    @Override
    @Transactional
    public long updateById(SettSupplierBalance request) {

        try {
            SettSupplierBalance balance = mapper.selectByPrimaryKey(request);
            log.info("结算入参 = {}", JSONObject.toJSONString(request));
            balance.setSts(2);
            balance.setTotal(balance.getTotal().subtract(balance.getAvailable()));
            balance.setFrozen(balance.getFrozen().add(balance.getAvailable()));
            balance.setDeleteFlag(1);
            balance.setAvailable(BigDecimal.valueOf(0));
            balance.setAmount(BigDecimal.valueOf(0));
            balance.setUpdater(request.getAdminOperate().getOperator());
            long l = mapper.updateById(balance);
            if (l == 1) {

                return 1;
            } else {
                throw new AppRuntimeException(ResponseCode.EXCEPTION, "结算失败");
            }
        } catch (Exception e) {
            log.error("结算失败", e);
            throw new AppRuntimeException(ResponseCode.EXCEPTION, "结算失败");
        }


    }

    @Override
    @Transactional
    public long updateByPrimaryKey(SettSupplierBalance param, String type, Long ids) {
        if (param == null) {
            throw new AppRuntimeException("6666", "参数为空");
        }
        if (param.getTotal() == null) {
            throw new AppRuntimeException("2333", "增加的积分不能为空");
        }
        SettSupplierBalance balance = mapper.selectByPrimaryKey(param);
        balance.setTotal(balance.getTotal().add(param.getTotal()));
        balance.setAvailable(balance.getAvailable().add(param.getTotal()));
        balance.setAmount(balance.getAmount().add(param.getTotal().divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_UP)));
        int i = mapper.updateByPrimaryKey(balance);
        if (i == 1) {
            //平台
            if ("0".equals(type)) {
                ConfPlatform confPlatform = new ConfPlatform();
                confPlatform.setId(ids);
                //根据id查询到对应的平台
                ConfPlatform confPlatform1 = confPlatformMapper.selectByPrimaryKey(confPlatform);
                //减去对应的积分
                confPlatform1.setTotal(confPlatform1.getTotal().subtract(param.getTotal()));
                confPlatform1.setAvailable(confPlatform1.getAvailable().subtract(param.getTotal()));
                int primaryKey = confPlatformMapper.updateByPrimaryKey(confPlatform1);
                if (primaryKey != 1) {
                    throw new AppRuntimeException(ResponseCode.EXCEPTION, "修改失败");
                }
                ConfPlatformLog confPlatformLog = new ConfPlatformLog();
                BeanUtils.copyProperties(confPlatform1, confPlatformLog);
                confPlatformLog.setId(0L);
                confPlatformLog.setDeptId(confPlatform1.getDeptId());
                confPlatformLog.setBdCode(confPlatform1.getBdCode());
                confPlatformLog.setPlatformCode(confPlatform1.getCode());
                confPlatformLog.setPointType(5);
                confPlatformLog.setDeliveryType(2);
                confPlatformLog.setType(2);
                confPlatformLog.setAmount(param.getTotal());
                confPlatformLog.setCreator(param.getCreator());
                confPlatformLog.setCreateTime(new Date());

                int selective = confPlatformLogMapper.insertSelective(confPlatformLog);
                if (selective != 1) {
                    throw new AppRuntimeException(ResponseCode.EXCEPTION, "增加流水失败");

                }
            } else if ("1".equals(type)) {
                ConfActivityRule confActivityRule = new ConfActivityRule();
                confActivityRule.setId(ids);
                ConfActivityRule confActivityRule1 = confActivityRuleMapper.selectByPrimaryKey(confActivityRule);
                confActivityRule1.setTotal(confActivityRule1.getTotal().subtract(param.getTotal()));
                confActivityRule1.setAvailable(confActivityRule1.getAvailable().subtract(param.getTotal()));
                int i1 = confActivityRuleMapper.updateByPrimaryKey(confActivityRule1);
                if (i1 != 1) {
                    throw new AppRuntimeException(ResponseCode.EXCEPTION, "活动修改失败");
                }
                ConfActivityRuleLog log = new ConfActivityRuleLog();
                BeanUtils.copyProperties(confActivityRule1, log);
                log.setId(0L);
                log.setAmount(param.getTotal());
                log.setDeliveryType(2);
                log.setType(2);
                log.setPointType(5);
                log.setBdCode(confActivityRule1.getBdCode());
                log.setPlatformCode(confActivityRule1.getPlatformCode().toString());
                log.setActivityRuleCode(confActivityRule1.getCode());
                log.setCreateTime(new Date());
                log.setCreator(param.getCreator());
                log.setDeleteFlag(0);
                int selective = confActivityRuleLogMapper.insertSelective(log);
                if (selective != 1) {
                    throw new AppRuntimeException(ResponseCode.EXCEPTION, "活动流水新增失败");
                }
            }
        } else {
            throw new AppRuntimeException("7777", "增加积分失败");
        }

        return i;
    }

    /**
     * 统计供应商流水
     *
     * @return 1，拿到结算规则 （根据规则表中的下次结算日期判断 如果没到不能切换规则） 每次结算完修改规则表中的上下次结算日期
     * 如果规则为一月一结 统计范围为 创建时间 —— 后一个月的时间
     * 2.根据规则多久统计一次供应商流水表（按周期统计）根据台账表中的结算时间判断范围类的流水
     * 3.统计完成 往供应商台账增加数据（需要汇率）修改状态为已结算 结算时间修改
     * 4.每天往台账流水表增加一条记录 进行逻辑删除 并且到了真正结算的日期时修改结算时间
     * 5.去找bd部门结账 减去相对应的金额
     * 6.供应商结算的钱加到哪里去？
     */

    @Transactional
    @Scheduled(cron = "0 0 0 1/1 * ?")
    public void getSupplierTimedTask() throws ParseException {

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar calendar = Calendar.getInstance();

        //查询启用的规则表
        SettSupplierRule rule = new SettSupplierRule();
        rule.setEnableDisable(1);
        SettSupplierRule rule1 = ruleMapper.selectIsEnable(rule);
        //拿到规则之后根据日期范围查询出信息
        List<ConfSupplierLog> confSupplierLogs = confSupplierLogMapper.queryByBetweenTime(rule1);

        if (confSupplierLogs == null) {
            throw new AppRuntimeException("没有供应商流水记录");
        }


        //供应商流水记录
        for (ConfSupplierLog confSupplierLog : confSupplierLogs) {
            //拿到deptId
            SysDeptResponse byIdPid = sysDeptApi.getByIdPid(confSupplierLog.getDeptId());
            System.out.println("得到的为" + JSON.toJSONString(byIdPid));
            //拿到汇率
            BigDecimal totol = new BigDecimal("0");
            BigDecimal available = new BigDecimal("0");
            BigDecimal frozen = new BigDecimal("0");

            ConfThirdPart confThirdPart = confThirdPartMapper.selectBydeptId(byIdPid.getId());
            System.out.println("得到的为" + JSON.toJSONString(confThirdPart.getExchangeRate()));
            //根据code和type过滤
            SettSupplierBalance supplierBalance = new SettSupplierBalance();
            confSupplierLog.setType(1);
            ConfSupplierLog confSupplierLog1 = confSupplierLogMapper.selectSupplierCode(confSupplierLog);
            confSupplierLog.setType(2);
            ConfSupplierLog confSupplierLog2 = confSupplierLogMapper.selectSupplierCode(confSupplierLog);
            confSupplierLog.setType(3);
            ConfSupplierLog confSupplierLog3 = confSupplierLogMapper.selectSupplierCode(confSupplierLog);
            BigDecimal init = new BigDecimal("0");
            if (confSupplierLog1 == null || confSupplierLog1.getAmount() == null) {
                confSupplierLog1 = new ConfSupplierLog();
                confSupplierLog1.setAmount(init);
            }
            if (confSupplierLog2 == null || confSupplierLog2.getAmount() == null) {
                confSupplierLog2 = new ConfSupplierLog();
                confSupplierLog2.setAmount(init);
            }
            if (confSupplierLog3 == null || confSupplierLog3.getAmount() == null) {
                confSupplierLog3 = new ConfSupplierLog();
                confSupplierLog3.setAmount(init);
            }
            totol = totol.add(confSupplierLog1.getAmount());
            System.out.println("积分为totol：" + totol);
            available = available.add(confSupplierLog2.getAmount());
            System.out.println("积分为available：" + available);
            frozen = frozen.add(confSupplierLog3.getAmount());
            System.out.println("积分为frozen：" + frozen);
            supplierBalance.setSupplierCode(confSupplierLog.getSupplierCode());
            SettSupplierBalance settSupplierBalances = supplierBalanceMapper.selectByCode(supplierBalance);

            //根据code查询台账表如果没有的话就新增 否则就修改
            if (settSupplierBalances == null) {

                System.out.println("总积分：" + totol);
                supplierBalance.setTotal(totol.add(frozen));
                supplierBalance.setFrozen(frozen);
                supplierBalance.setAvailable(supplierBalance.getTotal().subtract(available).subtract(frozen));
                supplierBalance.setCreateTime(new Date());
                supplierBalance.setSettEndTime(rule1.getEndTime());
                supplierBalance.setSettStartTime(rule1.getLastSettTime());

                supplierBalance.setSupplierCode(confSupplierLog.getSupplierCode());
                supplierBalance.setDeptId(byIdPid.getId());
                if (supplierBalance.getAvailable() != null || supplierBalance.getAvailable().compareTo(BigDecimal.valueOf(0)) == 1) {
                    supplierBalance.setAmount(supplierBalance.getAvailable().divide(confThirdPart.getExchangeRate(), 2, BigDecimal.ROUND_UP));
                }

                supplierBalance.setSts(1);
                supplierBalance.setDeleteFlag(0);
                supplierBalance.setIntervalType(rule1.getIntervalType());
                supplierBalance.setIntervalValue(rule1.getIntervalValue());
                int param = supplierBalanceMapper.insertSelective(supplierBalance);
                if (param == 1) {
                    log.info("=========新增成功=============");
                }
            } else {

                settSupplierBalances.setTotal(totol.add(frozen));
                settSupplierBalances.setFrozen(frozen);
                settSupplierBalances.setAvailable(settSupplierBalances.getTotal().subtract(available).subtract(frozen));
                settSupplierBalances.setCreateTime(new Date());
                settSupplierBalances.setSettEndTime(rule1.getNextSettTime());
                settSupplierBalances.setSettStartTime(rule1.getLastSettTime());
                settSupplierBalances.setSupplierCode(confSupplierLog.getSupplierCode());
                settSupplierBalances.setDeptId(byIdPid.getId());
                if (settSupplierBalances.getAvailable() != null || settSupplierBalances.getAvailable().compareTo(BigDecimal.valueOf(0)) == 1) {
                    settSupplierBalances.setAmount(settSupplierBalances.getAvailable().divide(confThirdPart.getExchangeRate(), 2, BigDecimal.ROUND_UP));
                }
                settSupplierBalances.setSts(1);
                settSupplierBalances.setDeleteFlag(0);
                settSupplierBalances.setIntervalType(rule1.getIntervalType());
                settSupplierBalances.setIntervalValue(rule1.getIntervalValue());
                int i = supplierBalanceMapper.updateByPrimaryKey(settSupplierBalances);

                if (i == 1) {
                    //如果到了结算日期 就往结算表添加一条数据
                    SettSupplierLog settSupplierLog = new SettSupplierLog();
                    if (new Date().getTime() >= settSupplierBalances.getSettEndTime().getTime()) {
                        settSupplierLog.setAmount(settSupplierBalances.getAmount());
                        settSupplierLog.setSupplierCode(settSupplierBalances.getSupplierCode());
                        settSupplierLog.setCreateTime(new Date());
                        settSupplierLog.setDeleteFlag(0);
                        settSupplierLog.setAuditTime(rule1.getNextSettTime());
                        settSupplierLog.setIntervalType(rule1.getIntervalType());
                        settSupplierLog.setIntervalValue(rule1.getIntervalValue());
                        settSupplierLog.setAuditTime(settSupplierBalances.getSettEndTime());
                        int i1 = settSupplierLogMapper.insertSelective(settSupplierLog);
                        log.info("=========修改成功=============");

                        //插入成功 修改结算日期
                        if (i1 == 1) {

                            if (rule1.getIntervalType().equals("年")) {
                                calendar.setTime(rule1.getNextSettTime());
                                calendar.add(Calendar.YEAR, rule1.getIntervalValue());
                                Date time = calendar.getTime();
                                rule1.setLastSettTime(new Date());
                                rule1.setNextSettTime(time);
                            }
                            if (rule1.getIntervalType().equals("月")) {
                                calendar.setTime(rule1.getNextSettTime());
                                calendar.add(Calendar.MONTH, rule1.getIntervalValue());
                                Date time = calendar.getTime();
                                System.out.println("修改后的時間為" + time);
                                rule1.setLastSettTime(new Date());
                                rule1.setNextSettTime(time);
                            }
                            if (rule1.getIntervalType().equals("日")) {
                                calendar.setTime(rule1.getNextSettTime());
                                calendar.add(Calendar.DATE, rule1.getIntervalValue());
                                Date time = calendar.getTime();
                                rule1.setLastSettTime(new Date());
                                rule1.setNextSettTime(time);
                            }
                            if (rule1.getIntervalType().equals("季度")) {
                                calendar.setTime(rule1.getNextSettTime());
                                Date time = calendar.getTime();
                                int i2 = calendar.get(Calendar.MONTH);
                                double floor = Math.floor((i2 + 3) / 3);
                                System.out.println(floor);
                                calendar.add(Calendar.MONTH, rule1.getIntervalValue() * 3);
                                rule1.setLastSettTime(new Date());
                                rule1.setNextSettTime(time);
                            }
                            rule1.setDeleteFlag(1);
                            int i2 = supplierRuleMapper.updateByPrimaryKey(rule1);
                            log.info("=========成功=============");
                        }

                    }
                }

            }

        }

    }

//    /**
//     * 1.根据code查询台账表中是否存在这个供应商 或者会员的信息 如果有则根据表中的结算日期进行结算 么有就去查询规则表拿到规则表中的结算日期
//     * 然后需要去类目数中找到对应的汇率
//     * 2.如果是会员的话 根据type判断 新增还是减少还是冻结 扣除会员的积分 然后往会员log表中生成流水 以便结算
//     * 3.如果是供应商结算 根据type 判断 根据供应商编码 统计需要结算的积分 然后找到对应的活动去扣除对应活动的积分
//     * 扣除活动规则主表的积分 每次扣除需要往流水表中生成流水留痕 无需考虑平台 因为活动在生成的时候 平台已经把积分给到了活动了 ，
//     * 然后根据对应的部门编码进行结算 结算完留痕 log表 每次结算需要判断 结算人是否有这么多的积分或者金额 如果没有的话？
//     */
//    @Transactional
//    //@Scheduled(cron = "0 0 0 1/1 * ?")
//    public void getCloseAnAccount() {
//
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        Calendar calendar = Calendar.getInstance();
//
//        //查询启用的规则表
//        SettSupplierRule rule = new SettSupplierRule();
//        rule.setEnableDisable(1);
//        SettSupplierRule rule1 = ruleMapper.selectIsEnable(rule);
//        if(rule1==null){
//            log.info("没有启用的规则");
//        }
//
//        //拿到规则之后根据日期范围查询出信息
//        List<ConfSupplierLog> confSupplierLogs = confSupplierLogMapper.queryByBetweenTime(rule1);
//        if (confSupplierLogs == null) {
//            log.info("没有供应商流水记录");
//        }
//
//
//        //供应商流水记录
//        for (ConfSupplierLog confSupplierLog : confSupplierLogs) {
//            //拿到deptId
//            SysDeptResponse byIdPid = sysDeptApi.getByIdPid(confSupplierLog.getDeptId());
//            System.out.println("得到的为" + JSON.toJSONString(byIdPid));
//
//            BigDecimal totol = new BigDecimal("0");
//            BigDecimal available = new BigDecimal("0");
//            BigDecimal frozen = new BigDecimal("0");
//            //拿到汇率
//            ConfThirdPart confThirdPart = confThirdPartMapper.selectBydeptId(byIdPid.getId());
//            System.out.println("得到的为" + JSON.toJSONString(confThirdPart.getExchangeRate()));
//
//        }
//
//    }

}
